#!/usr/bin/pyton

from Tkinter import *

class Application(Frame):
	def __init__(self, master = None):
		Frame.__init__(self, master)
		self.pack()
		self.createWidgets()

	def createWidgets(self):
		self.helloLabel = Label(self, text="Hello, world!")
		self.helloLabel.pack()
		self.quitButton = Button(self, text='Quit', command=self.quit)
		self.quitButton.pack()

app = Application()
app.master.title("Title")
app.mainloop()

# def fn(self, name = "world."):
# 	print "Hello, %s." % name

# Hello = type("Hello", (object, ), dict(hello = fn))
# h = Hello()
# h.hello("Usual")
# print Hello
# print Hello()
# print type(Hello)
# print type(h)

# class MyObject(object):
# 	def __call__(sefl):
# 		print "MO"

# obj = MyObject()
# obj()
# print callable(obj)

# class Chain(object):
# 		def __init__(self, path = ""):
# 			self._path = path

# 		def __getattr__(self, path):
# 			self._path = "%s/%s" % (self._path, path)
# 			return self

# 		def __str__(self):
# 			return self._path

# print Chain().status.user.timeline.list

# class MyObject(object):
# 	def __init__(self, name):
# 		self.name = name
# 		self.a, self.b = 0, 1

# 	def __str__(self):
# 		return "My name is: %s" % self.name

# 	__repr__ = __str__

# 	def __iter__(self):
# 		return self

# 	def next(self):
# 		self.a, self.b = self.b, self.a + self.b
# 		if (self.a > 100000):
# 			raise StopIteration()
# 		return self.a

# 	def __getitem__(self, n):
# 		if isinstance(n, int):
# 			a, b = 0, 1
# 			for x in range(n):
# 				a, b = b, a + b
# 			return a
# 		if isinstance(n, slice):
# 			start, stop = n.start, n.stop
# 			a, b = 0, 1
# 			L = []
# 			for x in range(stop):
# 				if x > start:
# 					L.append(a)
# 				a, b = b, a+b
# 			return L

# 	def __getattr__(self, attr):
# 		if attr == "ok":
# 			return "OK!"
# 		raise AttributeError("\'Student\' object has no attributes \'%s\'" % attr)


# obj = MyObject("Usual")
# print obj
# obj

# for i in obj:
# 	print i

# print obj[10]
# print obj[4:66]

# print obj.ok
# print obj.okd

# class Animal(object):
# 	pass

# class Mammal(Animal):
# 	pass

# class Bird(Animal):
# 	pass

# class Dog(Mammal):
# 	pass

# class Cat(Mammal):
# 	pass

# class Parrot(Bird):
# 	pass

# class Ostrich(Bird):
# 	pass


# class Runnable(object):
# 	def run(self):
# 		print ("Running.")

# class Flyable(object):
# 	def fly(self):
# 		print ("Flying.")

# class Dog(Mammal, Runnable):
# 	pass

# class Cat(Mammal, Runnable):
# 	pass

# dog = Dog()
# cat = Cat()

# dog.run()

# class Student(object):

# 	@property
# 	def birth(self):
# 		return self._birth

# 	@birth.setter
# 	def birth(self, value):
# 		self._birth = value

# 	@property
# 	def age(self):
# 		return 2014 - self._birth

# stu = Student()
# stu.birth = 1994
# print stu.birth
# print stu.age

# class MyObject(object):
# 	__slots__ = ("name", "age", "set_age")

# obj = MyObject()

# obj.name = "Usual"
# print obj.name

# def set_age(self, age):
# 	self.age = age

# from types import MethodType

# obj.set_age = MethodType(set_age, obj, MyObject)
# obj.set_age(100)
# print obj.age

# oobj = MyObject()
# # oobj.set_age(100)

# MyObject.set_age = MethodType(set_age, None, MyObject)

# oobj.set_age(100)
# print oobj.age

# import types

# tps = [int, "str", 123, None, type, [], u'abc']

# for i in tps:
# 	print type(i)

# print len(tps), tps.__len__()

# print isinstance("abc", (str, unicode))
# print isinstance("abc", basestring)

# for i in dir("abc"):
# 	print i

# print type("str") == types.StringType

# class MyObject(object):
# 	def __init__(self):
# 		self.x = 1

# obj = MyObject()

# print hasattr(obj, 'x')
# print hasattr(obj, 'y')

# print getattr(obj, 'y', 404)
# print setattr(obj, 'y', 100)
# print getattr(obj, 'y', 404)

# class Animal(object):
# 	'''Base class Animal.'''
# 	def __init__(self):
# 		pass

# 	def run(self):
# 		print "Animal is running..."

# class Dog(Animal):
# 	'''A type of Animal named dog.'''
# 	def __init__(self):
# 		pass
# 	def run(self):
# 		# super.run(self)
# 		print "Dog is running..."
# 	def eat(self):
# 		print "Dog is eatting..."

# class Cat(Animal):
# 	'''A type of Animal named cat.'''
# 	def __init__(self):
# 		pass

# dog = Dog()
# dog.run()
# dog.eat()

# print isinstance(dog, Dog)
# print isinstance(dog, Animal)

# class Student(object):
	
# 	def __init__(self, name, score):
# 		self.__name = name
# 		self.__score = score

# 	def print_score(self):
# 		print "The score of %s is %d." % (self.__name, self.__score)

# Usual = Student("Usual", 98)
# Usual.print_score()

# print Usual
# print Usual._Student__name
		

# print "No __future__.division"

# print "10 / 3 =", 10 / 3
# print "10.0 / 3 =", 10.0 / 3
# print "10 // 3 =", 10 // 3

# from __future__ import division

# print "Import __future__.division"

# print "10 / 3 =", 10 / 3
# print "10.0 / 3 =", 10.0 / 3
# print "10 // 3 =", 10 // 3

# import functools

# print int ("12345", 16)
# int2 = functools.partial(int, base = 2)
# print int2("1001")
# print int2("1001", base=10)

# import functools

# def log(func):
# 	def wraper(*args, **kw):
# 		print "Call %s():" % func.__name__
# 		return func(*args, **kw)
# 	return wraper

# @log
# def now():
# 	print "2014-10-04"

# now()

# def log(text):
# 	def decorator(func):
# 		@functools.wraps(func)
# 		def wraper(*args, **kw):
# 			print "%s %s():" % (text, func.__name__)
# 			return func(*args, **kw)
# 		return wraper
# 	return decorator

# @log("Excute")
# def now():
# 	print "2014"

# now()

# print now.__name__

# def now():
# 	print "2014-10-04"

# print now.__name__

# f = now
# print f.__name__

# print map(lambda x : x * x, range(1,10))

# def build(x, y):
# 	return lambda : x * x + y * y

# print build(3, 4)
# print build(3, 4)()

# def lazy_sum(*args):
# 	def sum():
# 		rtn = 0
# 		for i in args:
# 			rtn = rtn + i
# 		return rtn
# 	return sum

# print lazy_sum(5,7,9,4,3)()

# def cmp(x,y):
# 	if x > y:
# 		return -1
# 	elif x == y:
# 		return 0
# 	else:
# 		return 1

# arr = [4, 87, 54, 33, 86, 34]
# print sorted(arr)
# print sorted(arr, cmp)

# def f(x):
# 	return x * x

# print map(f, range(1,10))

# def ff(x, y):
# 	return x * 10 + y

# print reduce(ff, range(1,10))

# print range(1,10)
# print range(1,10,2)

# print reduce(ff,map(int,"1234"))

# def str2int(str):
# 	def ff(x,y):
# 		return x*10 + y

# 	return reduce(ff,map(int, str))

# print str2int("25567")

# def fib(max):
# 	n, a, b = 0, 0, 1
# 	while n < max:
# 		yield b
# 		a, b = b, a+b
# 		n = n +1

# for i in fib(100):
# 	print i

# g = ( x*x for x in range(1,10))
# print g
# print g.next()
# print g.next()
# print g
# for n in g:
# 	print n

# L = ['Hello', 'World', 'IBM', 'Apple', 8]
# print [v.lower() for v in L if (isinstance(v, str))]

# d = {'x': 'A', 'y': 'B', 'z': 'C' }
# [k + '=' + v for k, v in d.iteritems()]

# datas = {'x':'a', 'y':'b', 'z':'c'}
# arr = [k + '=' + v for k, v in datas.iteritems()]
# print arr

# for t in (x * x for x in range(1,11) if (x % 2 == 0)):
# 	print t

# for value in [m + n for m in "ABC" for n in "XYZ"]:
# 	print value

# str = "Hello world!"
# print str[::2]

# def func(a, b, c = 0, *args, **kw):
# 	print "a=", a, "b=", b, "c=", c
# 	print "args=", args
# 	print "kw=", kw
# 	print

# func(1,2)
# func(1,3,c=3)
# func(1,2,3)
# func(1,2,3,4)
# func(1,2,d=3,e=4)

# def _abs(num = 0):
# 	if not isinstance(num, (int, float)):
# 		raise TypeError("bad operand type")

# 	if num>0:
# 		return num, True
# 	else:
# 		return -num, False
# 	pass

# a, b = _abs()
# print a
# print b

# a = "abc"
# b = a.replace('a', 'A')
# print 'a:', a
# print 'b:', b

# s = set(range(3))
# t = set(range(6))
# print "s:",s
# print "t:",t
# print "s & t", s & t
# print "s | t", s | t

# names = {'Michael':78,'Bob':96,'Tracy':44}
# print names

# for k in names:
# 	print k

# for v in names.itervalues():
# 	print v

# for k, v in names.iteritems():
# 	print "[%s,%d]" % (k, v)
	# print k,v

# print "The score of Michael:",names['Michael']

# print "Michael in names:",'Michael' in names;
# print "Usual in names:",'Usual' in names;

# print names.get('Michael', -1)
# print names.get('Usual', -1)
# names.pop("Michael")
# print names[1]

# names = {'hello':'hello','who':'who'}
# print names['hello']
# age = input("Input you age:")
# print "Your age is", age
# if age>18:
# 	print "Adult!"
# elif age>6:
# 	print "Teenager!"

# age = input("Input your age:")
# if age >= 18:
#     print 'your age is', age
#     print 'adult'

# classmates = ['Michael', 'Bob', 'Tracy']
# classmates.append("Adam")
# classmates.insert(3,"Jack")
# print classmates
# print len(classmates)
# classmates.pop(2)
# classmates[2] = "Sarah"
# print classmates

# for i in classmates:
# 	print i

# print len('\xe4\xb8\xad\xe6\x96\x87'.decode("utf-8"))

# name = raw_input("Input your name please:");

# print "Hello,", name,"."

# print r'''
# 	Hello, my friend.
# 	I'm waiting here, for you.
# '''

# print 1==1

# print "Hello, %s." % (name)